package cz.movie.subRenamerGUI;

import java.util.Locale;
import java.util.ResourceBundle;

public class Messages {

	public static ResourceBundle messages;

	public static void init() {
		try {
			messages = ResourceBundle.getBundle("MessagesBundle", new Locale(System.getProperty("user.language")));
		} catch (Exception e) {
			e.printStackTrace();
			// messages = ResourceBundle.getBundle("MessagesBundle");
		}
	}

	public static void init(Locale language) {
		try {
			messages = ResourceBundle.getBundle("MessagesBundle", language);
		} catch (Exception e) {
			e.printStackTrace();
			// messages = ResourceBundle.getBundle("MessagesBundle");
		}
	}

	public static String getMessage(String code) {
		if (messages != null) {
			return messages.getString(code);
		} else {
			return code;
		}

	}
}
